package router

import (
	"github.com/gin-gonic/gin"
	jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
	"tuowei.com/app/api/apis"
)

func init() {
	routerNoCheckRole = append(routerNoCheckRole, codeLoginRouter)
	routerCheckRole = append(routerCheckRole, codeCheckLoginRouter)

}

func codeLoginRouter(v1 *gin.RouterGroup) {
	api := apis.ApiLogin{}

	v1auth := v1.Group("/code")
	{
		v1auth.POST("/login", api.CodeLogin)
	}
}

func codeCheckLoginRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
	api := apis.ApiLogin{}

	v1auth := v1.Group("/code").Use(authMiddleware.MiddlewareFunc())
	{
		v1auth.POST("/logout", api.Logout)
	}
}
